<!--
 * @Description: 
 * @Author: charles
 * @Date: 2020-11-03 14:05:02
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2021-07-08 10:49:04
-->
<template>
  <div>
    <!-- 头部 -->
    <Header></Header>
    <div class="article_container">
      <!-- 文章标题 -->
      <div class="head">
        <div class="title">{{ article.title }}</div>
        <div class="publishtime">所属栏目：旅游快讯  
          发布时间：{{ article.publishTime | fmtDate }}
        </div>
        <!-- /文章标题 -->
      </div>

      <div class="article_content" v-html="article.content"></div>

      <!-- 文章列表 -->
      <Footer></Footer>
    </div>
  </div>
</template>
<script>
// import { Footer } from 'element-ui'
import { get } from "../utils/request";
// 1. 导入
import Header from "./components/Header";
import Footer from "./components/Footer";
import fmtDate from "../filters/index.js";
import moment from 'moment'
export default {
  // 2. 注册
  components: {
    Header,
    Footer,
  },
  filters: {
    fmtDate(date) {
      return date ? moment(date).format("YYYY-MM-DD") : "";
    },
  },
  data() {
    return {
      article: {},
    };
  },

  created() {
    // 1.获取项目id
    let articleId = this.$route.query.articleId;
    // 2.通过项目id查询项目
    let url = "/index/article/findById";
    let param = { id: articleId };
    get(url, param).then((resp) => {
      this.article = resp.data;
    });
    // 3.展示到页面中
  },
};
</script>

<style lang="scss" scoped>
.article_container {
  background: rgb(233, 231, 231);
  .head {
    text-align: center;
    padding: 30px 20px;
    border-bottom: 1px solid #ededed;
    .title {
      font-size: 25px;
      font-weight: bolder;
    }
    .publishtime {
      padding: 5px 10px;
    }
  }
  .article_content {
    line-height: 30px;
    font-size: 18px;
    width: 75%;
    margin: 0 auto;
  }
}
</style>